import React from 'react';
import { connect } from 'react-redux';
import { Button } from 'antd';

import { userRequest } from '../../redux/actions/user';
import { authRequest } from '../../redux/actions/auth';
import Subcomp from './Subcomp';

@connect(state => {
  const { auth } = state.toObject();
  return {
    auth
  }
},{
  authRequest,
  userRequest
})
class ImmutableDemo extends React.Component {
  handlerClick = ()=> {
    // this.props.authRequest();
    this.props.userRequest()
  }

  render(){
    const data = this.props.auth.value;
    return(
      <div style={{background:'red',marginTop:20}}>
        immutableDemo
        <Subcomp data={data}/>
        <Button onClick={this.handlerClick}>点击测试immutable</Button>  
      </div>
    )
  }
}
export default ImmutableDemo